def shell_sort(arr):
    le = len(arr)
    d = int(le / 2)
    print(f"shell_sort 初始arr==>{arr}")
    while d :
        for i in range(0, d):
            for j in range(i+d, le, d):
               if arr[j] < arr[j - d]:
                   insert_num = arr[j]
                   for k in range(j -d, -1, -d):
                       if arr[k] > insert_num:
                           arr[k + d] = arr[k]
                           if k - d < 0:
                               arr[k] = insert_num
                       else:
                           arr[k + d] = insert_num
                           break
            print(f'{arr}')
        d = int(d / 2)
    return arr

arr = [81, 94, 11, 96, 12, 35, 17, 95, 28, 58, 41, 75, 15]

print(shell_sort(arr))

